//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Query Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity;
using EntLibContrib.Query.Configuration.Unity;
using EntLibContrib.Query.Queries;

namespace EntLibContrib.Query.Configuration
{
	/// <summary>
	/// Configuration data defining XmlQueryData. This configuration section adds the element
	/// </summary>    
	[Assembler(typeof(XmlFileQueryAssembler))]
	[ContainerPolicyCreator(typeof(XmlFileQueryPolicyCreator))]
	public class XmlFileQueryData : FileQueryData
	{
		#region Constants
		private const string elementProperty = "element";
		#endregion

		#region Properties
		/// <summary>
		/// The xml element to use.
		/// </summary>
		/// <value>The xml element.</value>
		[ConfigurationProperty(elementProperty, IsRequired = false)]
		public string Element
		{
			get { return (string)base[elementProperty]; }
			set { base[elementProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlFileQueryData"/> class.
		/// </summary>
		public XmlFileQueryData ()
		{
		}

		/// <summary>
		/// Initialize a new instance of the <see cref="XmlFileQueryData"/> class.
		/// </summary>
		/// <param name="name">The name of the <see cref="XmlFileQueryData"/>.</param>
		/// <param name="customCommandName">Name of the custom command.</param>
		/// <param name="parameterSetName">Name of the parameter set.</param>
		/// <param name="dataFile">The data file.</param>
		/// <param name="element">The element in the data file that holds a data object.</param>
		public XmlFileQueryData(string name, string customCommandName, string parameterSetName, string dataFile, string element)
			: base(name, typeof(XmlFileQuery), customCommandName, parameterSetName, dataFile)
		{
			this.Element = element;
		}
		#endregion
	}
}